package com.example.demo.controller;

import com.example.demo.service.BarService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@CrossOrigin
public class BarController {

  @Autowired
  private BarService service;

//  无体型分类

  @RequestMapping("/health_care")
  @CrossOrigin
  public Map health_care(){
    Map<String, Object> map = new HashMap<>();
    int all = service.health_care();
    map.put("all",all);
    return map;
  }

  @RequestMapping("/nursing")
  @CrossOrigin
  public Map dog_nursing(){
    Map<String, Object> map = new HashMap<>();
    int all = service.dog_nursing();
    map.put("all",all);
    return map;
  }

  @RequestMapping("/bath")
  @CrossOrigin
  public Map travel_and_bath(){
    Map<String, Object> map = new HashMap<>();
    int all = service.travel_and_bath();
    map.put("all",all);
    return map;
  }

//  有体型分类

  @RequestMapping("/clothing")
  @CrossOrigin
  public Map clothing(){
    Map<String, Object> map = new HashMap<>();
    int small =  service.clothing_small();
    int medium = service.clothing_medium();
    int large = service.clothing_large();
    map.put("small",small);
    map.put("medium",medium);
    map.put("large",large);
    return map;
  }

  @RequestMapping("/toy")
  @CrossOrigin
  public Map toy(){
    Map<String, Object> map = new HashMap<>();
    int small =  service.toy_small();
    int medium = service.toy_medium();
    int large = service.toy_large();
    map.put("small",small);
    map.put("medium",medium);
    map.put("large",large);
    return map;
  }

  @RequestMapping("/leash")
  @CrossOrigin
  public Map leash(){
    Map<String, Object> map = new HashMap<>();
    int small =  service.leash_small();
    int medium = service.leash_medium();
    int large = service.leash_large();
    map.put("small",small);
    map.put("medium",medium);
    map.put("large",large);
    return map;
  }

  @RequestMapping("/doghouse")
  @CrossOrigin
  public Map doghouse(){
    Map<String, Object> map = new HashMap<>();
    int small =  service.doghouse_small();
    int medium = service.doghouse_medium();
    int large = service.doghouse_large();
    map.put("small",small);
    map.put("medium",medium);
    map.put("large",large);
    return map;
  }

  @RequestMapping("/snack")
  @CrossOrigin
  public Map snack(){
    Map<String, Object> map = new HashMap<>();
    int small =  service.snack_small();
    int medium = service.snack_medium();
    int large = service.snack_large();
    map.put("small",small);
    map.put("medium",medium);
    map.put("large",large);
    return map;
  }

  @RequestMapping("/staple_food")
  @CrossOrigin
  public Map staple_food(){
    Map<String, Object> map = new HashMap<>();
    int small =  service.staple_food_small();
    int medium = service.staple_food_medium();
    int large = service.staple_food_large();
    map.put("small",small);
    map.put("medium",medium);
    map.put("large",large);
    return map;
  }

  @RequestMapping("/daily_article")
  @CrossOrigin
  public Map daily_article(){
    Map<String, Object> map = new HashMap<>();
    int small =  service.daily_article_small();
    int medium = service.daily_article_medium();
    int large = service.daily_article_large();
    map.put("small",small);
    map.put("medium",medium);
    map.put("large",large);
    return map;
  }

  @RequestMapping("/cosmetology")
  @CrossOrigin
  public Map cosmetology(){
    Map<String, Object> map = new HashMap<>();
    int small =  service.cosmetology_small();
    int medium = service.cosmetology_medium();
    int large = service.cosmetology_large();
    map.put("small",small);
    map.put("medium",medium);
    map.put("large",large);
    return map;
  }

  @RequestMapping("/cleaning")
  @CrossOrigin
  public Map cleaning(){
    Map<String, Object> map = new HashMap<>();
    int small =  service.cleaning_small();
    int medium = service.cleaning_medium();
    int large = service.cleaning_large();
    map.put("small",small);
    map.put("medium",medium);
    map.put("large",large);
    return map;
  }

}
